package leader.action;

import java.text.SimpleDateFormat;
import java.util.Date;

import leader.service.DirectProjectService;
import teacher.bean.Flow;
import teacher.bean.Patent;
import teacher.bean.Project;
import teacher.service.flow;
import teacher.service.project;

public class DirectProjectCheckAction {
	private Project project;

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}
	public String execute() {
		project.setState(4);
		DirectProjectService PS = new DirectProjectService();
		PS.updateProjectState(project);
//		流程管理开始
		Project a=new Project();
		a=new project().selectProjectById(this.getProject().getProId());
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Flow f=new Flow();
		f.setFruitId(a.getProId());
		f.setFruitKind(4);
		f.setDirDo(0);
		f.setDirTime(df.format(new Date()));
		f.setSubDo(2);
		f.setSubTime(df.format(new Date()));
		f.setTeaDo(2);
		f.setTeaTime(df.format(new Date()));
//		流程管理结束
		if(new flow().insertFlow(f)){
			return "success";
		}else{
			return "success";
		}
	}
}
